import jwt
import time

# 生成一个token
def generateToken():
    d = {
        # 公共声明
        'exp': time.time() + 1000*30*60,  # (Expiration Time) 此token的过期时间的时间戳
        'iat': time.time(),  # (Issued At) 指明此创建时间的时间戳
        'iss': 'Issuer',  # (Issuer) 指明此token的签发者
    }
    jwt_encode = jwt.encode(d, 'AABBCCDD', algorithm='HS256')
    return jwt_encode
# 打印token串
# eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MjI2MDQ3MTguNjczNjgzNiwiaWF0IjoxNjIyNjAxNzE4LjY3MzY4MzYsImlzcyI6Iklzc3VlciIsImRhdGEiOnsidXNlcm5hbWUiOiJ4amoiLCJ0aW1lc3RhbXAiOjE2MjI2MDE3MTguNjczNjgzNn19.ASgB9-1U9ADhv6AmBH7p8leEtWMTMhaDQJSaZ9z9kZg
